
package es.eupt.amazingpi.server.gestion;

import java.util.ArrayList;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryonet.EndPoint;
import com.esotericsoftware.kryonet.rmi.ObjectSpace;

import es.eupt.amazingpi.model.juego.Clasificacion;
import es.eupt.amazingpi.model.juego.Ficha;
import es.eupt.amazingpi.model.juego.Jugador;
import es.eupt.amazingpi.model.juego.MensajeJuego;
import es.eupt.amazingpi.model.juego.ResultadosCategoria;
import es.eupt.amazingpi.model.usuario.MensajeUsuario;
import es.eupt.amazingpi.model.usuario.Usuario;
import es.eupt.amazingpi.sync.Mensaje;

public class Network {
	static public final int port = 12345;

	// These IDs are used to register objects in ObjectSpaces.
	static public final short PLAYER = 1;
	static public final short CHAT_FRAME = 2;
	
	public static final String TO = "to";
	public static final String TO_ALL = "all";
	public static final String TO_ALL_EXCEPT = "toAllExcept";

	// This registers objects that are going to be sent over the network.
	static public void register (EndPoint endPoint) {
		Kryo kryo = endPoint.getKryo();
		// This must be called in order to use ObjectSpaces.
		ObjectSpace.registerClasses(kryo);
		// The interfaces that will be used as remote objects must be registered.
		kryo.register(Mensaje.class);
		kryo.register(MensajeUsuario.class);
		// The classes of all method parameters and return values
		// for remote objects must also be registered.
		kryo.register(MensajeJuego.class);
		kryo.register(Ficha.class);
		kryo.register(int[].class);
		kryo.register(String[][].class);
		kryo.register(String[].class);
		kryo.register(ResultadosCategoria.class);
		kryo.register(Clasificacion.class);
		kryo.register(ArrayList.class);
		kryo.register(Jugador.class);
		kryo.register(Usuario.class);
	}
}
